import Vue from 'vue'
import App from './App.vue'
import router from '@/router/index.js'

// 注册全局组件【三级联动】
import TypeNav from '@/components/TypeNav/TypeNav.vue'
Vue.component('TypeNav', TypeNav)
import Pagination from '@/components/Pagination/Pagination.vue'
Vue.component('Pagination', Pagination)

// 引入mock模拟数据
import '@/mock/mockServe.js'

// 引入vuex
import store from '@/store/index.js'

import 'swiper/css/swiper.css'

// elementUI
import { Button, MessageBox } from 'element-ui';
Vue.use(Button)
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

// 懒加载
import VueLazyload from 'vue-lazyload'
import ji from './assets/images/ji.jpg'
Vue.use(VueLazyload, { loading: ji })

// 表单验证
import '@/plugins/validate'

Vue.config.productionTip = false

new Vue({
    render: h => h(App),
    // 注册路由时，组件身上都有$router和$route属性，route获取路由信息【路径、query、params】，router做push跳转
    router: router,
    // 组件实例身上多了个$store属性
    store,
    // 全局事件总线
    beforeCreate() {
        Vue.prototype.$bus = this;
    }
}).$mount('#app')